package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserDao {
    public String userDao(String name) {
        PreparedStatement preparedStatement = null;
        Connection connection = null;
        ResultSet resultSet = null;
        try {
            connection = DBConnection.getConnection();
            preparedStatement = connection.prepareStatement("select * from m_admin where name=?  ");
            preparedStatement.setString(1, name);
            resultSet = preparedStatement.executeQuery();
            resultSet.next();
            return resultSet.getString(2);

        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }finally {
            DBConnection.release(connection,preparedStatement,resultSet);
        }

    }
}
